package r21310.chap06.d1118;


import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Tools {
    public static double getAry(List<student> list) {
        double sum=0;
        Iterator<student> it=list.listIterator();
        while (it.hasNext()){
            student stu=it.next();
            sum+=stu.getChengji();
        }
        return sum/list.size();
    }

        public static student getmax(List<student> list){
            Iterator<student> it=list.listIterator();
            student max= it.next();

            while (it.hasNext()){
                student stu= it.next();
                if (max.getChengji()<stu.getChengji()){
                   max=stu;
                }
            }
            return max;
        }
        public static List<student> getname(List<student> list){
            List<student> no=new ArrayList<>();
            Iterator<student> it=list.listIterator();
            while (it.hasNext()){
                student stu= it.next();
                if (stu.getChengji()<60){
                   no.add(stu);
                }

            }
            return no;
        }

}

